import { Popup, List, Button, WhiteSpace, TextareaItem } from 'antd-mobile';
import React from 'react';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import { connect } from 'dva';
import { createForm } from 'rc-form';
import { routerRedux } from 'dva/router';
import moment from 'moment';
import MyIcon from '../components/Base/MyIcon';

class VipInfoRemarksPage extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      remarks: this.props.value,
    };
  }

  onChange = (val) => {
    this.setState({ remarks: val });
  }

  onClose = (sel) => {
    this.setState({ sel });
    Popup.hide();
  };
  renderHeader = () => (
    <div style={{ position: 'relative' }}>
      修改备注
      <span
        style={{
          position: 'absolute', right: 3, top: -5,
        }}
        onClick={() => this.onClose('cancel')}
      >
        <MyIcon type="cross" />
      </span>
    </div>
  );

  render() {
    return (<div>
      <List
        renderHeader={this.renderHeader()}
      >
        <TextareaItem
          defaultValue={this.props.value}
          onChange={this.onChange}
          rows={7}
        />
      </List>
      <WhiteSpace />
      <div><Button
        type="primary" size="small" onClick={() => {
          this.props.onSave(this.state.remarks);
        }}
      >保存</Button></div>
    </div>);
  }
}


export default VipInfoRemarksPage;
